<template>
  <div class="user">
    <h2>User {{ $route.params.id }}</h2>
    <router-view></router-view>
  </div>

</template>

<script>
export default {
  watch: {
    '$route' (to, from) {
      // 对路由变化作出响应...
      console.log(to)
      console.log(from)
    }
  }
}

</script>